<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="__PUBLIC__/lib/layui/css/layui.css"  media="all">
  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
  <style type="text/css">
  html,body{
  margin: 5px 0px 0px 0px;
  width: 100%;
  height: 100%;
  overflow: hidden;
  }
  
#form{
    height: 125px;
  }
  .layui-form-item{
    margin-bottom: 0;
  }
  #greetings{
    position: absolute;
    height: auto;
    border-left: 1px solid rgba(0, 0, 0, 0.11);
    border-right: 1px solid rgba(0, 0, 0, 0.11);
    left: 0px;
    z-index:5555; 
  }
  #greetings ul{
        list-style: none;
    box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.44);
    -webkit-margin-before: 0em;
    -webkit-margin-after: 0em;
    -webkit-margin-start: 0px;
    -webkit-margin-end: 0px;
    -webkit-padding-start: 0px;
  }
  #greetings li{
        text-align: left;
    padding: 5px;
    font-family: inherit;
    border-bottom: 1px solid rgba(0, 0, 0, 0.16);
    height: 25px;
    width: 180px;
    line-height: 25px;
    background-color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
  }
  #greetings li:hover{
        background-color: rgba(175, 42, 0, 0.52);
      color: white;
  }
  #tianjiafy1{
    position: absolute;
    width: 132px;
    
    left: 0px;
    z-index:5555; 
  }
  
</style>
</head>
<body>

<form class="layui-form" action="{:U('fysousuo/index')}" method="get" target="iframe" id="form">

  <div class="layui-form-item">
    <div class="layui-inline">
    
    <div class="layui-input-inline" style="width:100px;margin-left:20px;">
      <select name="leixing" >
        <option value="2">出租</option>
        <option value="1">出售</option>
        <option value="">全部</option>
      </select>
    </div>
      <div class="layui-input-inline" style="width:400px;">
        <input type="text" name="sousuo" list="greetings"  autocomplete="off" placeholder="请输入房源编号、小区、业主姓名、电话、经纪人..." class="layui-input" id="sousuo" >
        <div id="greetings" >
           <ul id="tcontent">
              
           </ul>
        </div> 
      </div>
    </div>
    
    <div class="layui-inline">
      <button class="layui-btn layui-btn-radius" lay-submit="" lay-filter="demo1">立即查找</button>
      <button type="reset" class="layui-btn layui-btn-radius layui-btn-primary" >重置</button>
     
    </div>

    <div class="layui-inline">

      <div class="layui-input-inline" style="width:80px;margin-left:20px;">
        <select name="zhuangxiu" >
        <option value="">装修</option>
          <foreach name="zhuangxiu" item="pz">
              <option value="{$pz.lxid}">{$pz.lxming}</option>
          </foreach>
        </select>
      </div>
      <div class="layui-input-inline" style="width:80px;margin-left:20px;">
        <select name="chaoxiang" >
        <option value="">朝向</option>
          <foreach name="chaoxiang" item="pz">
              <option value="{$pz.lxid}">{$pz.lxming}</option>
          </foreach>
        </select>
      </div>
      <div class="layui-input-inline" style="width:100px;margin-left:20px;">
        <select name="yongtu" >
        <option value="">物业类型</option>
          <foreach name="yongtu" item="pz">
              <option value="{$pz.lxid}">{$pz.lxming}</option>
          </foreach>
        </select>
      </div>
    </div>

    <div class="layui-inline" style="float:right;" id="tianjiafy3">
       <a class="layui-btn  layui-btn-danger"  id="tianjiafy">
           添加房源
        </a>
        <div id="tianjiafy1" style="display: none;">
       <a class="layui-btn  layui-btn-danger" href="javascript:;" id="addEsfy" onclick="motai('添加房源','{:U('Fangyuan/addEsfy',array('jylx'=>'1'))}','950')" style="margin-top:5px;">
           添加(出售)房源
        </a>
        <a class="layui-btn  layui-btn-danger" href="javascript:;" id="addEsfy" onclick="motai('添加房源','{:U('Fangyuan/addEsfy',array('jylx'=>'2'))}','950')" style="margin-left:0px;margin-top:5px;">
           添加(出租)房源
        </a>
        </div>
        <a class="layui-btn layui-btn-radius layui-btn-primary" href="javascript:location.replace(location.href);" title="刷新" >刷新</a>

    </div>
  </div>

  <div class="layui-form-item" >
    <div class="layui-input-inline" style="width:100px;margin-left:20px;">
        <select name="zhuangtai" >
        <option value="0">全部</option>
          <foreach name="zhuangtai" item="pz">
              <option value="{$pz.lxid}" <if condition="$pz['lxid'] eq 1">selected=""</if>>{$pz.lxming}</option>
          </foreach>
        </select>
      </div>
    <div class="layui-input-block">
      <input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="我的房源" name="myfy" value="1"  /> 
      <input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="我的收藏" name="mysc" value="1"  />
      <input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="今日浏览" name="jrll" value="1"  />
      <input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="图片" name="tupian" value="1"  />
      <input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="新上" name="xinshang" value="1" />
      <input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="急售" name="jishou" value="1"  /> 
      <input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="学区房" name="xuequ" value="1"  />
      <input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="新证" name="xinzheng" value="1"  />
      <input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="有贷款" name="youdaikuan" value="1"  />
      <input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="外网同步" name="waiwangtb" value="1"  />
      <input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="有钥匙" name="yaoshi" value="1"  />
      <input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="小区名错误" name="noxiaoqu" value="1"  id="noxiaoqu"/>
    </div>  
  </div>
  <div class="layui-form-item">
    <input type="hidden" name="isget" value="1" >
      <label class="layui-form-label">价格</label>
      <div class="layui-input-inline" style="width: 50px;">
        <input type="text" name="jiage1" placeholder="￥" autocomplete="off" class="layui-input" >
      </div>
      <div class="layui-form-mid">-</div>
      <div class="layui-input-inline" style="width: 50px;">
        <input type="text" name="jiage2" placeholder="￥" autocomplete="off" class="layui-input" >
      </div>
      <label class="layui-form-label" style="width: 40px;">面积</label>
      <div class="layui-input-inline" style="width: 50px;">
        <input type="text" name="mianji1" placeholder="" autocomplete="off" class="layui-input" >
      </div>
      <div class="layui-form-mid">-</div>
      <div class="layui-input-inline" style="width: 50px;">
        <input type="text" name="mianji2" placeholder="" autocomplete="off" class="layui-input" >
      </div>
      <label class="layui-form-label" style="width: 40px;">时间</label>
      <div class="layui-input-inline" style="width: 100px;">
        <input class="layui-input" placeholder="开始日" id="LAY_demorange_s" name="shijian1">
      </div>
      <div class="layui-form-mid">-</div>
      <div class="layui-input-inline" style="width: 100px;">
        <input class="layui-input" placeholder="截止日" id="LAY_demorange_e" name="shijian2">
      </div>
      <label class="layui-form-label" style="width: 40px;">户型</label>
      <div class="layui-input-inline" style="width: 50px;">
        <input type="text" name="huxing1" placeholder="室" autocomplete="off" class="layui-input" >
      </div>
      <div class="layui-form-mid">-</div>
      <div class="layui-input-inline" style="width: 50px;">
        <input type="text" name="huxing2" placeholder="室" autocomplete="off" class="layui-input" >
      </div>
      <label class="layui-form-label" style="width: 40px;">楼层</label>
      <div class="layui-input-inline" style="width: 50px;">
        <input type="text" name="louceng1" placeholder="" autocomplete="off" class="layui-input" >
      </div>
      <div class="layui-form-mid">-</div>
      <div class="layui-input-inline" style="width: 50px;">
        <input type="text" name="louceng2" placeholder="" autocomplete="off" class="layui-input" >
      </div>
      <div class="layui-input-inline" style="width:100px;margin-left:20px;">
        <select name="paixu" lay-filter="paixu">
          <option value="1">默认排序</option>
          <option value="2">价格降序</option>
          <option value="3">价格升序</option>
          <option value="4">面积降序</option>
          <option value="5">面积升序</option>
          <option value="6">单价降序</option>
          <option value="7">单价升序</option>
        </select>
      </div>
  </div>
</form>
<iframe frameborder=0 width=100% height=70% marginheight=0 marginwidth=0  src="{:U('fysousuo/esfyc')}" id="iframe" name='iframe'></iframe>  
<script type="text/javascript" src="__PUBLIC__/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="__PUBLIC__/lib/layer/2.4/layer.js"></script>
<script src="__PUBLIC__/lib/layui/layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
	$(document).ready(function(){
	    $(document).bind("contextmenu",function(e){
	          return false;
	    });
	});
</script>
<script>
  function motai(title,url,w,h){
      layer_show(title,url,w,h);
    }

  function layer_show(title,url,w,h){
  if (title == null || title == '') {
    title=false;
  };
  if (url == null || url == '') {
    url="404.html";
  };
  if (w == null || w == '') {
    w=800;
  };
  if (h == null || h == '') {
    h=($(window).height() - 50);
  };
  layer.open({
    type: 2,
    area: [w+'px', h +'px'],
    fix: false, //不固定
    maxmin: false,
    skin: 'layui-layer-rim',
    shade:0.4,
    title: title,
    content: url,

  });
}

layui.use(['form', 'layedit', 'laydate'], function(){
  var form = layui.form(),
  layer = layui.layer,
  layedit = layui.layedit,
  laydate = layui.laydate;
  var start = {
    min: '2017-01-01 23:59:59',
    max: laydate.now(),
    istoday: false,
    choose: function(datas){
      end.min = datas; //开始日选好后，重置结束日的最小日期
      end.start = datas //将结束日的初始值设定为开始日
    }
  };
  
  var end = {
    min: '2017-01-01 23:59:59',
    max: laydate.now(),
    istoday: false,
    choose: function(datas){
      start.max = datas; //结束日选好后，重置开始日的最大日期
    }
  };
  document.getElementById('LAY_demorange_s').onclick = function(){
    start.elem = this;
    laydate(start);
  }
  document.getElementById('LAY_demorange_e').onclick = function(){
    end.elem = this
    laydate(end);
  }
  window.onload = function() {
     var istxt ='{$_GET['txt']}';
    if(istxt){
      $("#sousuo").val('{$_GET['txt']}');
      $('form').submit();
    }
  }; 
  form.on('checkbox(checkbox)', function(data){
    $('form').submit();
  });
  form.on('select(paixu)', function(data){
    $('form').submit();
  });
  form.on('select(province_id)', function(data){
    var province_id=data.value;
    $.ajax({
      url:'{:U('fangyuan/get_citys')}',
      Type:"POST",
      data:"province_id="+province_id,
      dataType:"json",
      success:function(data){
        var city = data.city;
        $("#city_id option").remove();
        $("#district_id option").remove();
        var option=$("<option></option>");
        $(option).val("");
        $(option).html("请选择");
        var option1=$("<option></option>");
        $(option1).val("");
        $(option1).html("请选择");
        $("#city_id").html(option);
        $("#district_id").html(option1);
        for(var i in city){
          var option=$("<option></option>");
          $(option).val(city[i]['id']);
          $(option).html(city[i]['pianqum']);
          $("#city_id").append(option);
        }
        form.render('select');
      }
    });
  }); 

  form.on('select(city_id)', function(data){
    var city_id=data.value;
    $.ajax({
      url:'{:U('fangyuan/get_district')}',
      Type:"POST",
      data:"city_id="+city_id,
      dataType:"json",
      success:function(data){
        var district = data.district;
        $("#district_id option").remove();
        var option=$("<option></option>");
        $(option).val("");
        $(option).html("请选择");
        $("#district_id").html(option);
        for(var i in district){
          var option=$("<option></option>");
          $(option).val(district[i]['id']);
          $(option).html(district[i]['xiaoqum']);
          $("#district_id").append(option);
        }
        form.render('select');
      }
    });
  }); 
  $("#sousuo").keyup(function(){
    $("#greetings").show();
    var txt=$("#sousuo").val();
    if (txt!="") {
      $.ajax({
        url:'{:U('Fysousuo/get_xiaoqu')}',
        Type:"POST",
        data:"txt="+txt,
        dataType:"json",
        success:function(data){
          var district = data.district;
          $("#tcontent li").remove();
          for(var i in district){
            var li=$("<li></li>");
            $(li).html(district[i]['xiaoqum']);
            $("#tcontent").append(li);
          }
          var tt1 = $("#greetings").height();
          if(tt1>250){
            $("#greetings").css({   //子菜单内容
             "overflow-y": "auto",
             "height": "250px"
           });
          }
        }
      });
    }
  });
  $("#tcontent").on("click","li", function() {  
    $("#greetings").show(); 
    //var v=$(this).text(); alert(v);        
    var Uarry=$("#tcontent li");  
    var count=$(this).index();//获取li的下标  
    var Tresult=Uarry.eq(count).text();  
    $("#sousuo").val(Tresult); 
    $("#greetings").hide(); 
  })
  $("body").click(function(){
    $("#greetings").hide();
  })
  
  $(document).ready(function(){  
    var h =$(document.body).height()-140;
    $("iframe").height(h);  
    //当文档窗口发生改变时 触发  
    $(window).resize(function(){ 
    var h =$(document.body).height()-140;
      $("iframe").height(h);  
    })  
  }) 
  $("#tianjiafy").mouseenter(function(){
    $("#tianjiafy1").css("display","block");
  });
  $("#tianjiafy3").mouseleave(function(){
    $("#tianjiafy1").css("display","none");
  });
});
</script>
</body>
</html>
